package com.cinema.entity;

/**
 * 放映厅实体类
 */
public class ScreeningRoom {
    private String id;
    private String name;
    private int rows;    // 座位行数
    private int cols;    // 座位列数
    
    /**
     * 构造方法
     * @param id 放映厅ID
     * @param name 放映厅名称
     * @param rows 座位行数
     * @param cols 座位列数
     */
    public ScreeningRoom(String id, String name, int rows, int cols) {
        this.id = id;
        this.name = name;
        this.rows = rows;
        this.cols = cols;
    }
    
    // Getter和Setter方法
    public String getId() {
        return id;
    }
    
    public void setId(String id) {
        this.id = id;
    }
    
    public String getName() {
        return name;
    }
    
    public void setName(String name) {
        this.name = name;
    }
    
    public int getRows() {
        return rows;
    }
    
    public void setRows(int rows) {
        this.rows = rows;
    }
    
    public int getCols() {
        return cols;
    }
    
    public void setCols(int cols) {
        this.cols = cols;
    }
    
    /**
     * 获取总座位数
     * @return 总座位数
     */
    public int getTotalSeats() {
        return rows * cols;
    }
    
    @Override
    public String toString() {
        return "ScreeningRoom{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", rows=" + rows +
                ", cols=" + cols +
                ", totalSeats=" + getTotalSeats() +
                '}';
    }
    
    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || getClass() != obj.getClass()) return false;
        ScreeningRoom room = (ScreeningRoom) obj;
        return id != null ? id.equals(room.id) : room.id == null;
    }
    
    @Override
    public int hashCode() {
        return id != null ? id.hashCode() : 0;
    }
} 